package com.oig.sys.workflow.entity;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Version;
import java.io.Serializable;


/**
 * @author wuxl
 * 自动化操作表 可以不同条件执行不同的操作
 */
@Getter
@Setter
@ToString
@Entity
@Table(name = "tb_auto_operation")
@EntityListeners({AuditingEntityListener.class})
public class TbAutoOperation implements Serializable {

	/**
	 */
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name = "id", nullable = false)
	private Integer id;

	/**
	 */
	@Column(name = "auto_rule_id")
	private Integer autoRuleId;

	/**
	 * {"$and":[ {"optime":{"$between":[1614528000000,1616256000000]}}, {"warehouseId":{"$in":[1,3,4]}},{"itemName":{"$like":"牛肉%"}}, {"$or":[{"price":{"$eq":1.1}},{"amount":{"$lt":1000}}]}]}
	 */
	@Column(name = "data_cfg")
	private String dataCfg;

	@Column(name = "data_cfg_view")
	private String dataCfgView;

	/**
	 * 1-预警通知  2-任务派送 
	 */
	@Column(name = "notify_flag")
	private String notifyFlag;


	/**
	 * 通知标题
	 */
	@Column(name = "notify_title")
	private String notifyTitle;

	/**
	 * 通知内容
	 */
	@Column(name = "notify_content")
	private String notifyContent;

	/**
	 * 消息类型 01-定向通知 02-群消息
	 */
	@Column(name = "notify_type")
	private String notifyType;
	/**
	 * 推送渠道id
	 */
	@Column(name = "push_channel_id")
	private Integer pushChannelId;
	/**
	 * 推送机器人（渠道名称）
	 */
	@Column(name = "push_channel_name")
	private String pushChannelName;

	/**
	 * 01-租户全员 02-部门 03-人员
	 */
	@Column(name = "receiver_type")
	private String receiverType;

	/**
	 * 根据receiver_type 来，如果type=01，为租户id，找到该租户下所有人员插入receiver表 如果type=02，为部门id，找到改部门下所有人员插入receiver表 如果type=03，发给指定人员列表， dto有接收者idList
	 */
	@Column(name = "receiver_id")
	private Integer receiverId;

	/**
	 */
	@Column(name = "receiver_name")
	private String receiverName;

	/**
	 */
	@Column(name = "task_flag")
	private String taskFlag;

	/**
	 */
	@Column(name = "task_title")
	private String taskTitle;

	/**
	 */
	@Column(name = "task_content")
	private String taskContent;

	/**
	 * 优先级 0-低  1-普通 2-紧急
	 */
	@Column(name = "task_priority")
	private String taskPriority;

	/**
	 * 重要性 0-不重要 1-普通 2-重要
	 */
	@Column(name = "task_level")
	private String taskLevel;

	/**
	 * 处理人id
	 */
	@Column(name = "task_user_id")
	private Integer taskUserId;

	/**
	 * 处理人
	 */
	@Column(name = "task_user_name")
	private String taskUserName;

	/**
	 * 跟踪人id
	 */
	@Column(name = "task_watch_id")
	private Integer taskWatchId;

	/**
	 * 跟踪人名称
	 */
	@Column(name = "task_watch_name")
	private String taskWatchName;


	/**
	 */
	@Column(name = "task_opt")
	private String taskOpt;

	@Column(name = "web_hook")
	private String webHook;

	/**
	 */
	@Version
	@Column(name = "version")
	private Integer version;
}
